package com.laosg.framework.fhir.springboot.service.impl;

import ca.uhn.fhir.rest.annotation.*;
import ca.uhn.fhir.rest.param.StringParam;
import ca.uhn.fhir.rest.server.IResourceProvider;
import org.hl7.fhir.dstu3.model.IdType;
import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.instance.model.api.IBaseResource;

import java.util.List;

/**
 * Created by kaimin on 3/7/2019.
 * time : 23:15
 */
public class TestResourceProvider implements IResourceProvider {

    //获取哪个类型的资源
    public Class<? extends IBaseResource> getResourceType() {
        return Patient.class;
    }
    //以下代码是处理这个resources


    @Read
    public Patient read(@IdParam IdType theId){
        Patient patient = new Patient();
        patient.addName().setFamily("123");
        return null;//返回这个信息
    }

    @Create
    public void create(@ResourceParam Patient patient){
        //保存这个资源
    }

    @Search
    public List<Patient> search(
            @OptionalParam(name = "family")StringParam family,
            @OptionalParam(name = "given")StringParam given
            ){
        return null;//操作这些搜索

    }

}
